#coding:utf8
from mongoengine import *
from random import randint
a=["赵","钱","孙","胡","吴","张","孔","朱","魏","罗"]
b=["利","伟","强","红","刚","芳","博文","三","富贵","二狗"]

connect("user")

class userlist(Document):
    name=StringField()
    age=IntField()
    birth=StringField()
    sex=IntField()
    addr=StringField()
    aid=IntField()

for firstname in a:
    for lastname in b:
        userlist(name=firstname+lastname,
                         age=randint(18,60),
                         birth='-'.join([str(randint(1950,1998)),str(randint(1,12)),str(randint(1,30))]),
                         sex=randint(0,1),
                         addr="湖北省武汉市",
                         aid=userlist.objects().count()+1,
                        ).save()
#d=userlist()
#d.name="sfsdfasfaf"
#d.save()

for i in userlist.objects():print i.name
